-
Notifications
You must be signed in to change notification settings - Fork 98
Adding support for PrefixList APIs #839
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
base: tmp-firewall-ruleset
Are you sure you want to change the base?
Adding support for PrefixList APIs #839
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for PrefixList APIs by implementing functionality to list and retrieve specific prefix lists from the Linode API.
- Introduces a new
PrefixListstruct with all necessary fields and custom JSON unmarshaling for timestamp handling - Adds
ListPrefixListsandGetPrefixListclient methods for API interaction - Provides comprehensive unit tests covering list, get, and JSON unmarshaling operations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| prefixlists.go | Implements PrefixList struct, custom JSON unmarshaling, and client methods for listing and getting prefix lists |
| test/unit/prefixlists_test.go | Adds comprehensive unit tests for PrefixList operations including list, get, and JSON unmarshaling scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@komer3 Is there any chance you could re-point this PR at the |
lgarber-akamai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation looks good and I verified that all changes align with the API specification. Thank you for the contribution!
| type PrefixList struct { | ||
| ID int `json:"id"` | ||
| Name string `json:"name"` | ||
| Description string `json:"description,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omitempty is not necessary in a resource struct which won't be used in an API request body.
| Description string `json:"description,omitempty"` | |
| Description string `json:"description"` |
| type PrefixList struct { | ||
| ID int `json:"id"` | ||
| Name string `json:"name"` | ||
| Description string `json:"description,omitempty"` | ||
| Visibility string `json:"visibility"` | ||
| SourcePrefixListID *int `json:"source_prefixlist_id"` | ||
| IPv4 *[]string `json:"ipv4"` | ||
| IPv6 *[]string `json:"ipv6"` | ||
| Version int `json:"version"` | ||
|
|
||
| Created *time.Time `json:"-"` | ||
| Updated *time.Time `json:"-"` | ||
| Deleted *time.Time `json:"-"` | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
customer_id seems to be missed here?
📝 Description
What does this PR do and why is this change necessary?
Adding support for listing and getting specific PrefixList APIs
✔️ How to Test
What are the steps to reproduce the issue or verify the changes?
How do I run the relevant unit/integration tests?
Added relevant unit tests (no integration since API is not currently available). Just run
make testto verfiy📷 Preview
If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.