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

upcoming: [M3-9088] - Add and update /v4/networking endpoints and types for Linode Interfaces #11559

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

coliu-akamai
Copy link
Contributor

@coliu-akamai coliu-akamai commented Jan 23, 2025

Description 📝

Updates existing and adds new /v4/networking endpoints for the Linode Interfaces project in accordance with API spec

Added a changeset for the Manager package after updating some factories. Is this changeset necessary? can remove it otherwise

How to test 🧪

  • Confirm changes match the API spec
  • Confirm generating a compliant firewall still works as expected
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

}

export interface FirewallRules {
fingerprint?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this field and version are mentioned in the documentation for the rules object when getting a firewall. I haven't seen them be returned when I tested the getTemplate endpoints, so including them as optional fields

Copy link
Member

Choose a reason for hiding this comment

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

Optional: Maybe eventually we should have a separate type for a firewall template's rule?

Not sure because the API spec claims same rules object as in Firewall GET like you said. We could follow up on this later

Comment on lines +12 to +16
vpc_nat_1_1?: {
address: string;
subnet_id: number;
vpc_id: number;
} | null;
Copy link
Contributor Author

@coliu-akamai coliu-akamai Jan 23, 2025

Choose a reason for hiding this comment

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

adding this field (looks like we were missing it previously). It got returned either as the object or a null value (or was omitted) when I tested the endpoint

*/
export const getTemplate = (templateSlug: string) =>
export const getTemplate = (templateSlug: FirewallTemplateSlug) =>
Copy link
Contributor Author

@coliu-akamai coliu-akamai Jan 23, 2025

Choose a reason for hiding this comment

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

These two endpoints (getTemplates and getTemplate) were added during the Securing VMs project (see internal ticket - I linked the spec there). I updated the templateSlug type to be more specific - I believe these are the three templates that exist so far, but am not sure. Since there may be a possibility for more slugs I'm not aware of, happy to switch back to string too

I've currently typed it as
export type FirewallTemplateSlug = 'akamai-non-prod' | 'vpc' | 'public'
See internal comments on spec about some naming updates - when testing the endpoint, I saw that vpc and public are the returned slugs

Comment on lines -17 to -22
entities: {
id: number;
type: FirewallDeviceEntityType;
label: string;
url: string;
}[];
Copy link
Contributor Author

@coliu-akamai coliu-akamai Jan 23, 2025

Choose a reason for hiding this comment

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

replacing this with FirewallDeviceEntity since it already exists

export interface FirewallDeviceEntity {
  id: number;
  type: FirewallDeviceEntityType;
  label: string;
  url: string;
}

@coliu-akamai coliu-akamai marked this pull request as ready for review January 23, 2025 20:58
@coliu-akamai coliu-akamai requested a review from a team as a code owner January 23, 2025 20:58
@coliu-akamai coliu-akamai requested review from carrillo-erik, abailly-akamai and bnussman-akamai and removed request for a team January 23, 2025 20:58
Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for those extra fixes in addition to the new types

packages/manager/src/factories/firewalls.ts Outdated Show resolved Hide resolved
}

export interface FirewallRules {
fingerprint?: string;
Copy link
Member

Choose a reason for hiding this comment

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

Optional: Maybe eventually we should have a separate type for a firewall template's rule?

Not sure because the API spec claims same rules object as in Firewall GET like you said. We could follow up on this later

Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
Copy link

github-actions bot commented Jan 24, 2025

Coverage Report:
Base Coverage: 79.11%
Current Coverage: 79.11%

@coliu-akamai coliu-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels Jan 24, 2025
@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 482 passing tests on test run #6 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing482 Passing2 Skipped104m 46s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants